var net = require('net');
var ClientItemMgr = require('./ClientItemMgr.js');

// var
var server = net.createServer();
var clientItemMgr = new ClientItemMgr();

// connection
server.on('connection', function(socket) {
	var clientDes = socket.remoteAddress + ':' + socket.remotePort;
	console.log('\n>>>>>>>>>>new connection:' + clientDes);
	clientItemMgr.connection(socket);
});

function start() {
	console.log('sockert start at 3001...');
	server.listen(3001);
}

module.exports = {
	start: start,
	clientItemMgr: clientItemMgr
}